/*
 * Middleware
 * Copyright (C) 2010/11
 * Riccardo Pulvirenti, Giuseppe Ravidà, Andrea Tino
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANDABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses
 */

/*!
 * File: core_test.hpp
 */

#ifndef _CORE_TEST_HPP_
#define _CORE_TEST_HPP_

#include <iostream>
#include <string>

#include "core.hpp"

namespace middleware {
//-----------------------------------------------------------------------------
// Definitions
/*!
 * Test function for TaskDescriptor
 */
void CoreTest();
//-----------------------------------------------------------------------------
// Implementations
void CoreTest() {
	// Testing
	try {
		std::cout << "Creating core as default..." << std::endl;
		CORE mycore;
		std::string par_val;
		std::cout << "Searching for parameter CONFIG_MODE..." << std::endl;
		par_val = mycore["CONFIG_MODE"];
		std::cout << "Obtained: " <<
						par_val <<	" is == no_res " <<
						(par_val == kParameterNotFound) << std::endl;
		std::cout << "Searching for parameter CONFIG_ADDRTOMAN_IP..." <<
				std::endl;
		par_val = mycore["CONFIG_ADDRTOMAN_IP"];
		std::cout << "Obtained: " <<
						par_val <<	" is == no_res " <<
						(par_val == kParameterNotFound) << std::endl;
		std::cout << "Searching for parameter CONFIG_ADDRTOMAN_PORT..." <<
				std::endl;
		par_val = mycore["CONFIG_ADDRTOMAN_PORT"];
		std::cout << "Obtained: " <<
						par_val <<	" is == no_res " <<
						(par_val == kParameterNotFound) << std::endl;
		std::cout << "Searching for parameter PARnonexisting..." << std::endl;
		par_val = mycore["PARnonexisting"];
		std::cout << "Obtained: " <<
				par_val <<	" is == no_res " <<
				(par_val == kParameterNotFound) << std::endl;
	} catch(std::exception& e) {
		std::cout << "Error: " << e.what() << std::endl;
	}
}
}

#endif
